﻿using Application.Dto;
using Application.IAppSrevices;
using AutoMapper;
using Domain.Entitys;
using Domain.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.CFFKService
{
    public class SSDService : ISSDService
    {
        private readonly IMapper mapper;
        private readonly ISSDDRepositoy sSDDRepositoy;
        public SSDService(ISSDDRepositoy sSDDRepositoy, IMapper mapper)
        {
            this.sSDDRepositoy = sSDDRepositoy;
            this.mapper = mapper;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sSDAddDto"></param>
        /// <returns></returns>
        public  async Task<int> SSDAddAsync(List<SSDAddDto> sSDAddDtos)
        {
            List<SSD> sSDs = mapper.Map<List<SSD>>(sSDAddDtos);
            return  await sSDDRepositoy.SSDAddAsync(sSDs);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sSDDeleteDto"></param>
        /// <returns></returns>
        public async Task<int> SSDdelectAsync(SSDDeleteDto sSDDeleteDto)
        {
            SSD sSD = mapper.Map<SSD>(sSDDeleteDto);
            return await sSDDRepositoy.SSDdelectAsync(sSD);
        }

        /// <summary>
        /// 查询全部薪酬数据
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<List<SSD>> SSDFileAsync()
        {
            return await sSDDRepositoy.SSDFileAsync();
        }

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<List<SSD>> SSDselectAsync(int pageIndex, int pageSize)
        {
            return await sSDDRepositoy.SSDselectAsync(pageIndex, pageSize);
        }

        /// <summary>
        /// 根据薪酬编号查询数据
        /// </summary>
        /// <param name="sid"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<List<SSD>> SSDSelectBySid(string sid)
        {
            return await sSDDRepositoy.SSDSelectBySid(sid);
        }

        /// <summary>
        /// 总数
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public int SSDSelectCount()
        {
           return  sSDDRepositoy.SSDSelectCount();
        }

        /// <summary>
        /// 修改薪酬标准设置
        /// </summary>
        /// <param name="sSDs"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> SSDUpdateAsync(List<SSD> sSDs)
        {
            return await sSDDRepositoy.SSDUpdateAsync(sSDs);
        }
    }
}
